package com.eqdd.yiqidian.ui.mine.unsure;

import android.databinding.DataBindingUtil;

import com.eqdd.yiqidian.R;
import com.eqdd.yiqidian.base.BaseActivity;
import com.eqdd.yiqidian.FarenwuActivityCustom;
import com.eqdd.yiqidian.bean.EditBean;
import com.eqdd.yiqidian.ui.base.BaseEditActivity;
import com.eqdd.yiqidian.utils.ToastUtil;

import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.view.View;
import android.widget.TextView;

public class FarenwuActivity extends BaseEditActivity {
    private FarenwuActivityCustom dataBinding;
    private String[] titles = new String[]{
            "任务名称",
            "关联父项目",
            "责任人",
            "协助人（多选）",
            "知会人（可选+多选）",
            "任务开始时间",
            "结束时间",
            "验收标准",
            "验收人",
            "验收时间",
            "责任（奖罚）"
    };
    private String[] titleTexts = new String[]{
            "任务名称",
            "关联父项目",
            "责任人",
            "协助人（多选）",
            "知会人（可选+多选）",
            "任务开始时间",
            "结束时间",
            "验收标准",
            "验收人",
            "验收时间",
            "责任（奖罚）"
    };
    private String[] hintTexts = new String[]{
            "请输入",
            "请输入",
            "请输入",
            "请选择",
            "请选择",
            "请选择",
            "请选择",
            "请输入",
            "请选择",
            "请选择",
            "请输入"
    };
    private String[] tipTexts = new String[]{
            "任务名称",
            "关联父项目",
            "责任人",
            "协助人（多选）",
            "知会人（可选+多选）",
            "任务开始时间",
            "结束时间",
            "验收标准",
            "验收人",
            "验收时间",
            "责任（奖罚）"
    };
    private int[] types = new int[]{
            0,0,0,0,0,2,3,0,0,2,0
    };
    private int[] decoders = new int[]{11};
    private String msg;

    @Override
    public void initBinding() {
        dataBinding = DataBindingUtil.setContentView(this, R.layout.activity_farenwu);
        initTopTitleBar(View.VISIBLE, "发送任务");
        initTopRightText("发送",(v)->{
            if (checkInfo()){

            }else {
                ToastUtil.showLong(msg);
            }
        });
    }

    private boolean checkInfo() {
        if (TextUtils.isEmpty(((TextView) quickAdapter.getViewByPosition(0, R.id.tv_vertical_content)).getText().toString().trim())) {
            msg = "请选择户口性质";
            return false;
        }
        return true;
    }

    @Override
    public void initData() {
//        int index = 0;
        for (int i = 0; i < titles.length; i++) {
            EditBean editBean = new EditBean();
            editBean.setTitle(titles[i]);
            editBean.setType(types[i]);
            editBean.setContent("");
            editBean.setTextTip(tipTexts[i]);
            editBean.setTextTitle(titleTexts[i]);
            editBean.setHint(hintTexts[i]);
            editBean.setEnter(false);
            editBeans.add(editBean);
//            if (index < decoders.length && i == decoders[index]) {
//                index++;
//                editBean.setBottom(true);
//                editBean.setUnderLine(false);
//            }
        }
    }


    @Override
    protected RecyclerView initRecyclerView() {
        return dataBinding.recyclerView;
    }

    @Override
    public void itemClick(int p) {

    }

    @Override
    public void onClick(View v) {
        super.onClick(v);
        switch (v.getId()) {

        }
    }
}
